package com.shuqing.download.engine.distribute.dispatch.upload.strategy;

import com.shuqing.download.engine.constants.ActuatorEnum;
import com.shuqing.download.engine.constants.EventEnum;
import com.shuqing.download.engine.distribute.dispatch.TaskContext;
import com.shuqing.download.engine.distribute.dispatch.upload.AbstractUploadActuator;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author wangshuqing
 * @date 2023/2/24 18:32
 */
@Slf4j
@Component
public class AbstractUploadSimpleActuator extends AbstractUploadActuator {


    @Override
    public ActuatorEnum actuatorEnum() {
        return ActuatorEnum.UPLOAD_DEFAULT;
    }

    @Override
    public void execute(TaskContext context) {
        log.info("下载任务:{},文件保存在：{}",context.getTask().getId(),context.getFileAbsolutePath());
        //TODO 完成上传功能
        monitorLeader.assignSuccessEvent(context, EventEnum.UPLOAD_SUCCESS,context.getFileNameWithSuffix());
    }
}
